﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="Fish_Atlantis.Account.Register" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transition al.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <title>亚特兰蒂斯——注册界面</title>
    <link href="../Styles/register-box.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var str, str1, str2, tem;
        function check() {
            tem = 1;
            if (!check1() || !check2() || !check3() || !check4() || !check5()) {
                return false;
            }
            else {
                return true;
            }
        }
        function check1() {
            var reg = "^[A-Za-z0-9_][A-Za-z0-9_]{5,12}";
            var exist;
            str = document.getElementById("Text1").value;
            if (str == "") {
                if (tem == 1)
                    alert("请输入用户名！");
                return false;
            }
            else if (str.length < 6) {
                if (tem == 1)
                    alert("用户名太短！");
                return false;
            }
            else if (!str.match(reg)) {
                if (tem == 1)
                    alert("用户名格式错误，只能是数字、字母或下划线！");
                return false;
            }
            else {
                return true;
            }
        }
        function check2() {
            str = document.getElementById("Text2").value;
            if (str == "") {
                if (tem == 1)
                    alert("请输入密码！");
                return false;
            }
            else if (str.length < 6) {
                if (tem == 1)
                    alert("密码长度太短！");
                return false;
            }
            else {
                return true;
            }
        }
        function check3() {
            str1 = document.getElementById("Text2").value;
            str2 = document.getElementById("Text3").value;
            if (str2 == "") {
                if (tem == 1)
                    alert("请再次输入密码！");
                return false;
            }
            else if (str1 != str2) {
                if (tem == 1)
                    alert("密码不一致！");
                return false;
            }
            else
                return true;
        }
        function check4() {
            str = document.getElementById("Text4").value;
            var reg = "[a-zA-Z0-9][a-z0-9_-]{3,15}@[a-zA-Z0-9]*.[a-zA-Z]*";
            if (str == "") {
                if (tem == 1)
                    alert("请输入Email！");
                return false;
            }
            else if (!str.match(reg)) {
                if (tem == 1)
                    alert("Email格式不正确！");
            }
            else {
                return true;
            }
        }
        function check5() {
            str = document.getElementById("Text5").value;
            var reg = "^\d{11}$";
            if (str == "") {
                if (tem == 1)
                    alert("请输入手机号！");
                return false;
            }
            else if (str.length != 11) {
                if (tem == 1)
                    alert("手机号码长度不正确！");
            }
            else {
                return true;
            }
        }
        function notno() {
            //alert(window.event.keyCode);
            if (window.event.keyCode == 32)
                event.returnValue = false;
        }
        function change1() {
            tem = 0;
            x = document.getElementById("Text1");
            if (!check1())
                x.style.color = '#8800ff';
            else
                x.style.color = '#008800';
        }
        function change2() {
            tem = 0;
            x = document.getElementById("Text2");
            if (!check2())
                x.style.color = '#8800ff';
            else
                x.style.color = '#008800';
        }
        function change3() {
            tem = 0;
            x = document.getElementById("Text3");
            if (!check3())
                x.style.color = '#8800ff';
            else
                x.style.color = '#008800';
        }
        function change4() {
            tem = 0;
            x = document.getElementById("Text4");
            if (!check4())
                x.style.color = '#8800ff';
            else
                x.style.color = '#008800';
        }
        function change5() {
            tem = 0;
            x = document.getElementById("Text5");
            if (!check5())
                x.style.color = '#8800ff';
            else
                x.style.color = '#008800';
        }
    </script>
</head>
<body background="../Image/86859-106.jpg">
    <div style="padding: 80px 0 0 0;">
        <form id="Form1" runat="server">
        <div id="register-box">
            <div id="reg1" style="margin: 85px 0 0 50px;" class="reg-box-field">
                <input type="text" id="Text1" onkeydown="notno()" onblur="change1()" class="form-login" placeholder="请输入用户名" maxlength="20"
                    runat="server" />
            </div>
            <div id="reg2" style="margin: 14px 0 0 50px;" class="reg-box-field">
                <input id="Text2" type="password" onkeydown="notno()" onblur="change2()" class="form-login" placeholder="请输入密码" maxlength="20"
                    runat="server" />
            </div>
            <div id="reg3" style="margin: 14px 0 0 50px;" class="reg-box-field">
                <input id="Text3" type="password" onkeydown="notno()" onblur="change3()" class="form-login" placeholder="请再次输入密码" maxlength="20"
                    runat="server" />
            </div>
            <div id="reg4" style="margin: 15px 0 0 50px;" class="reg-box-field">
                <input id="Text4" onkeydown="notno()" class="form-login"  onblur="change4()" placeholder="请输入Email" maxlength="20"
                    runat="server" />
            </div>
            <div id="reg5" style="margin: 15px 0 0 50px;" class="reg-box-field">
                <input id="Text5" onkeydown="notno()" onblur="change5()"
                    class="form-login" placeholder="请输入手机号" maxlength="20" runat="server" />
            </div>
            <div id="reg6" class="styled-select">
                <select id="select" class="form-login" wmode="transparent" runat="server">
                    <option value="Customer" class="styled-option" selected="selected">Customer</option>
                    <option value="supplier" class="styled-option">supplier</option>
                    <option value="professor" class="styled-option">professor</option>
                </select>
            </div>
            <div id="btn" style="margin: 15px 0 0 10px; ">
                <a id="A1" runat="server" onclick="if(!check())return false" onserverclick="btn_sub_Click">
                    <img src="/image/button.png" 
                    style="margin-left: 50px; height: 38px; width: 111px;" /></a>
                     <a id="A2" href="Login.aspx">
                    <img src="/image/1233.png" 
                    style="margin-left: 11px; height: 38px; width: 111px;" /></a>
            </div>
        </div>
        </form>
    </div>
</body>
</html>
